<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Register</title>
<style>
.form-item {
	margin: 20px 0;
}

.form-label {
	font-weight: bold;
}

.form-error-message {
	color: #900;
}

.form-error-field {
	background-color: #FFC;
}

.form-global-error-message {
	width: 500px;
	padding: 6px;
	background: #E2ABAB;
	color: #FFF;
	font-weight: bold;
}
</style>
<script type="text/javascript">
	window.onload = function() {
		document.getElementById("firstName").focus();
	}
</script>
</head>
<body>
	<h1>Register</h1>
	<p>All fields are required.</p>
	<form:form modelAttribute="user">
		<spring:bind path="user">
			<spring:hasBindErrors name="user">
				<div class="form-global-error-message">
					<form:errors />
				</div>
			</spring:hasBindErrors>
		</spring:bind>
		<div class="form-item">
			<div class="form-label">First name:</div>
			<form:input path="firstName" size="40"
				cssErrorClass="form-error-field" />
			<div class="form-error-message">
				<form:errors path="firstName" />
			</div>
		</div>
		<div class="form-item">
			<div class="form-label">Last name:</div>
			<form:input path="lastName" size="40"
				cssErrorClass="form-error-field" />
		</div>
		<div class="form-item">
			<div class="form-label">E-mail address:</div>
			<form:input path="email" size="40" />
			We won't spam you
		</div>
		<div class="form-item">
			<div class="form-label">User name:</div>
			<form:input path="username" size="40" />
		</div>
		<div class="form-item">
			<div class="form-label">Password:</div>
			<form:password path="password" showPassword="true" size="40" />
		</div>
		<div class="form-item">
			<div class="form-label">Confirm password:</div>
			<form:password path="passwordConfirmation" showPassword="true"
				size="40" />
		</div>
		<div class="form-item">
			<form:checkbox path="marketingOk" />
			Please send me product updates by e-mail. <br /> (You can
			unsubscribe at any time.)
		</div>
		<div class="form-item">
			<form:checkbox path="acceptTerms" />
			I accept the <a href="#" target="_blank"> terms of use</a>.
		</div>
		Please see our <a href="#" target="_blank">privacy policy</a>.
		<div class="form-item">
			<input type="submit" value="Register" />
		</div>
	</form:form>
</body>
</html>